<link rel="stylesheet" type="text/css" href="/assets/addons/fastflow/css/form-builder.css">
<style>
    .tab-pane{
        padding: 0 20px 0 20px;
        overflow: auto;
		scrollbar-width: thin;
    }
    .tab-content{
        height: calc(100vh - 170px);
    }
    .relation-fieldlist .dropdown-menu.inner{
        max-height:200px!important;
    }
    .customform-content .widgetActive{
        border: 2px dashed #fc6666 !important;
        padding: 3px !important;
    }
    .toolbar{
        background: white;
        box-shadow: 0 1px 1px rgb(0 0 0 / 10%);
        margin-top: -13px;
        padding: 8px 15px 8px 15px;
    }
    @-webkit-keyframes rotation {
        0% {
            transform: rotate(0deg);
        }
        100% {
            transform: rotate(360deg);
        }
    }
    .loading {
        background: transparent;
        position: absolute;
        width: 100%;
        height: 90%;
        z-index: 999
    }
    .loader {
        width: 60px;
        height: 60px;
        border: 4px solid #e5e5e5;
        border-bottom-color: #ee5c5c;
        border-radius: 50%;
        display: inline-block;
        -webkit-animation: rotation 1s linear infinite;
        animation: rotation 1s linear infinite;
        position: absolute;
        left: 40%;
        top: 40%;
    }
    .content{
        background: #f1f4f6;
    }
    .footer{
        height: 34px;
        background: white;
        padding: 8px 15px 8px 15px;
    }
    .nav-tabs-custom{
        margin-bottom: 6px!important;
    }
    .input-group .input-group-addon{
        background-color: #f7f7f7;
    }
    #chooseicon {
        margin:10px;
    }
    #chooseicon ul {
        margin:5px 0 0 0;
    }
    #chooseicon ul li{
        width:41px;height:42px;
        line-height:42px;
        border:1px solid #efefef;
        padding:1px;
        margin:1px;
        text-align: center;
        font-size:18px;
    }
    #chooseicon ul li:hover{
        border:1px solid #2c3e50;
        cursor:pointer;
    }
    .relationfields{
        width: 160px!important;
    }
    #customform .fieldlist dd input{
        width: 110px!important;
    }
    legend {
        padding-bottom: 5px;
        font-size: 14px;
        font-weight: 600;
        padding-left: 0px;
        padding-right: 0px;
        padding-top: 0px;
        cursor: pointer;
    }
    legend a{
        color: #5a90d3;
    }
    .widget{
        margin-left: 0;
        margin-right: 0;
    }
    div ::-webkit-scrollbar {
        /*滚动条整体*/
        width: 4px;
        height: 6px;
        border-radius: 5px;
    }
    div ::-webkit-scrollbar-track {
        /*滚动条轨道*/
        background: #b3b3b3;
        border-radius: 2px;
    }
    div ::-webkit-scrollbar-thumb {
        /*滚动条里面的滑块*/
        border-radius: 2px;
    }
    div ::-webkit-scrollbar-thumb:hover {
        /*滚动条鼠标事件，鼠标放上去出现的事件*/
        background: #717171;
    }
    div ::-webkit-scrollbar-corner {
        /*滚动条边角*/
        background: #555555;
    }
</style>
<div class="toolbar">
    <div class="row" style="margin-right: 100px;">
        <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12" style="margin-bottom: 8px;">
            <label class="control-label" style="width: 80px;">单据标题</label><input class="form-control" name="billName" type="text" style="width: 120px;display: inline-block">
        </div>
        <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12" style="margin-bottom: 8px;">
            <label class="control-label" style="width: 80px;">数据表名</label><input class="form-control" name="billTable" type="text" style="width: 120px;display: inline-block">
        </div>
        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
            <div class="checkbox">
                <label>表包含：</label>
                <label for="createtime"><input id="createtime" checked="checked" name="row[createtime]" type="checkbox" value="cratetime"> 创建时间</label>
                <label for="updatetime"><input id="updatetime" checked="checked" name="row[updatetime]" type="checkbox" value="updatetime"> 更新时间</label>
            </div>
        </div>
    </div>
    <a href="javascript:;" class="btn btn-sm btn-success pull-right btn-createbill" style="margin-top: -36px;"><i class="fa fa-save"></i> 生成单据</a>
</div>
<div class="row">
    <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
        <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#widget" data-toggle="tab" aria-expanded="false">组件</a></li>
            </ul>
            <div class="tab-content">
                <div class="loading">
                    <div class="loader"></div>
                </div>
                <div class="tab-pane active widget-content" id="widget">

                    <legend data-widget="widget-basic" data-collapse="false">
                        <a href="javascript:;" class="widget-collapse"><i class="fa fa-th-large"></i> 基础组件</a>
                        <a href="javascript:;" class="btn btn-box-tool pull-right widget-collapse"><i class="fa fa-minus collapse-icon"></i></a>
                    </legend>
                    <div class="row widget widget-basic" data-type="inputText" data-title="文本框">
                        <label class="control-label col-xs-12 col-sm-4">文本框:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input class="form-control" type="text">
                        </div>
                    </div>
                    <div class="row widget widget-basic" data-type="inputNumber" data-title="数值框">
                        <label class="control-label col-xs-12 col-sm-4">数值框:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input class="form-control" type="number" step="1">
                        </div>
                    </div>
                    <div class="row widget widget-basic widget-radio" data-type="radio" data-title="单选框">
                        <label class="control-label col-xs-12 col-sm-4">单选框:</label>
                        <div class="col-xs-12 col-sm-8">
                            <div class="radio">
                                <label for="widgetRadio-1"><input id="widgetRadio-1" checked="checked" name="row[widgetRadio]" type="radio" value="a"> A</label>
                                <label for="widgetRadio-2"><input id="widgetRadio-2" name="row[widgetRadio]" type="radio" value="b"> B</label>
                            </div>
                        </div>
                    </div>
                    <div class="row widget widget-basic widget-checkbox" data-type="checkbox" data-title="复选框">
                        <label class="control-label col-xs-12 col-sm-4">复选框:</label>
                        <div class="col-xs-12 col-sm-8">
                            <div class="checkbox">
                                <label for="widgetCheckbox-1"><input id="widgetCheckbox-1" checked="checked" name="row[widgetCheckbox]" type="checkbox" value="a"> A</label>
                                <label for="widgetCheckbox-2"><input id="widgetCheckbox-2" name="row[widgetCheckbox]" type="checkbox" value="b"> B</label>
                            </div>
                        </div>
                    </div>
                    <div class="row widget widget-basic" data-type="switch" data-title="开关组件">
                        <label class="control-label col-xs-12 col-sm-4">开关组件:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input id="widgetSwitch" name="row[widgetSwitch]" class="form-control" type="hidden" value="0">
                            <a href="javascript:;" data-toggle="switcher" class="btn-switcher " data-input-id="widgetSwitch" data-yes="1" data-no="0" draggable="false"><i class="fa fa-toggle-on text-success fa-2x"></i></a>
                        </div>
                    </div>
                    <div class="row widget widget-basic" data-type="tagsinput" data-title="标签组件">
                        <label class="control-label col-xs-12 col-sm-4">标签组件:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input type="text" class="form-control" data-role='tagsinput' value="标签1,标签2" />
                        </div>
                    </div>
                    <div class="row widget widget-basic" data-type="textarea" data-title="文本框(多行)">
                        <label class="control-label col-xs-12 col-sm-4">文本框(多行):</label>
                        <div class="col-xs-12 col-sm-8">
                            <textarea class="form-control" rows="5" cols="50"></textarea>
                        </div>
                    </div>

                    <legend data-widget="widget-datetime" data-collapse="true">
                        <a href="javascript:;" class="widget-collapse"><i class="fa fa-th-large"></i> 日期时间</a>
                        <a href="javascript:;" class="btn btn-box-tool pull-right widget-collapse"><i class="fa fa-plus collapse-icon"></i></a>
                    </legend>
                    <div class="row widget widget-datetime hidden" data-type="date" data-title="日期选择">
                        <label class="control-label col-xs-12 col-sm-4">日期选择:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true"  type="text" value="{:date('Y-m-d')}">
                        </div>
                    </div>
                    <div class="row widget widget-datetime hidden" data-type="datetime" data-title="日期时间">
                        <label class="control-label col-xs-12 col-sm-4">日期时间:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true"  type="text" value="{:date('Y-m-d H:i:s')}">
                        </div>
                    </div>
                    <div class="row widget widget-datetime hidden" data-type="datetimeRange" data-title="时间区间">
                        <label class="control-label col-xs-12 col-sm-4">时间区间:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input data-locale="{&quot;format&quot;:&quot;HH:mm:ss&quot;}" data-ranges="[]" data-show-custom-range-label="false" data-time-picker="true" class="datetimerange form-control" name="row[widgetTimerange]" type="text" value="">
                        </div>
                    </div>

                    <legend data-widget="widget-list" data-collapse="true">
                        <a href="javascript:;" class="widget-collapse"><i class="fa fa-th-large"></i> 列表组件</a>
                        <a href="javascript:;" class="btn btn-box-tool pull-right widget-collapse"><i class="fa fa-plus collapse-icon"></i></a>
                    </legend>
                    <div class="row widget widget-list hidden" data-type="selectpicker" data-title="下拉列表">
                        <label class="control-label col-xs-12 col-sm-4">下拉列表:</label>
                        <div class="col-xs-12 col-sm-8">
                            <select class="selectpicker form-control" name="row[widgetSelectpicker]">
                                <option value="a" selected="selected">A</option>
                                <option value="b">B</option>
                            </select>
                        </div>
                    </div>
                    <div class="row widget widget-list hidden" data-type="selectpage" data-title="动态下拉列表">
                        <label class="control-label col-xs-12 col-sm-4">动态下拉列表:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input data-source="/" data-field="name" data-primary-key="id" class="selectpage form-control" name="row[selectpage]" type="text">
                        </div>
                    </div>
                    <div class="row widget widget-list hidden" data-type="userSelectpage" data-title="会员选择">
                        <label class="control-label col-xs-12 col-sm-4">会员选择:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input data-source="user/user/index" data-field="nickname" data-primary-key="id" class="selectpage form-control" name="row[widgetUserselect]" type="text">
                        </div>
                    </div>
                    <div class="row widget widget-list hidden" data-type="adminSelectpage" data-title="管理员选择">
                        <label class="control-label col-xs-12 col-sm-4">管理员选择:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input data-source="auth/admin/selectpage" data-field="nickname" data-primary-key="id" class="selectpage form-control" name="row[widgetAdminselect]" type="text">
                        </div>
                    </div>
                    <div class="row widget widget-list hidden" data-type="categorySelectpage" data-title="分类选择">
                        <label class="control-label col-xs-12 col-sm-4">分类选择:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input data-source="category/selectpage" data-field="name" data-primary-key="id" class="selectpage form-control" name="row[widgetCategoryselect]" type="text">
                        </div>
                    </div>

                    <legend data-widget="widget-file" data-collapse="true">
                        <a href="javascript:;" class="widget-collapse"><i class="fa fa-th-large"></i> 图片文件</a>
                        <a href="javascript:;" class="btn btn-box-tool pull-right widget-collapse"><i class="fa fa-plus collapse-icon"></i></a>
                    </legend>
                    <div class="row widget widget-file hidden" data-type="image" data-title="图片">
                        <label class="control-label col-xs-12 col-sm-4">图片:</label>
                        <div class="col-xs-12 col-sm-8">
                            <div class="input-group">
                                <input size="50" id="widgetImage" name="row[widgetImage]" class="form-control" type="text">
                                <div class="input-group-addon no-border no-padding">
                                    <span><button class="btn btn-danger plupload"  data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" type="button"><i class="fa fa-upload"></i> 上传</button></span>
                                    <span><button class="btn btn-danger fachoose"  data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" type="button"><i class="fa fa-list"></i> 选择</button></span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row widget widget-file hidden" data-type="file" data-title="文件">
                        <label class="control-label col-xs-12 col-sm-4">文件:</label>
                        <div class="col-xs-12 col-sm-8">
                            <div class="input-group">
                                <input size="50" id="widgetFile" name="row[widgetFile]" class="form-control" type="text">
                                <div class="input-group-addon no-border no-padding">
                                    <span><button id="plupload-rowupload" class="btn btn-danger plupload" type="button"><i class="fa fa-upload"></i> 上传</button></span>
                                    <span><button id="fachoose-rowupload" class="btn btn-danger fachoose" type="button"><i class="fa fa-list"></i> 选择</button></span>
                                </div>
                                <span class="msg-box n-right" for="c-rowupload"></span>
                            </div>
                        </div>
                    </div>

                    <legend data-widget="widget-fieldlist" data-collapse="true">
                        <a href="javascript:;" class="widget-collapse"><i class="fa fa-th-large"></i> 键值组件</a>
                        <a href="javascript:;" class="btn btn-box-tool pull-right widget-collapse"><i class="fa fa-plus collapse-icon"></i></a>
                    </legend>
                    <div class="row widget widget-fieldlist hidden" data-type="fieldlist" data-title="键值组件">
                        <label class="control-label col-xs-12 col-sm-4">键值组件:</label>
                        <div class="col-xs-12 col-sm-8">
                            <dl class="fieldlist" data-name="row[fieldlist]">
                                <dd>
                                    <ins>键</ins>
                                    <ins>值</ins>
                                </dd>
                                <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a></dd>
                                <textarea name="row[fieldlist]" class="form-control hide" cols="30" rows="5"></textarea>
                            </dl>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
    <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
        <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#customform" data-toggle="tab" aria-expanded="false">自定义表单</a></li>
                <li class="pull-right">
                    <a href="javascript:;" style="color: #f75444" class="customform-clear"><i class="fa fa-trash text-danger"></i> 清空</a>
                </li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane active customform-content" id="customform">

                </div>
            </div>
        </div>
    </div>
    <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
        <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#widgetConfig" data-toggle="tab" aria-expanded="false">字段参数</a></li>
                <li><a href="#billConfig" data-toggle="tab" aria-expanded="false" id="billConfigBtn">单据配置</a></li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane active configform-content" id="widgetConfig">
                    <form class="form-horizontal" role="form" id="widgetConfig-form">
                        <div class="form-group" data-type="name">
                            <label class="control-label col-xs-12 col-sm-3">字段名:</label>
                            <div class="col-xs-12 col-sm-9">
                                <div class="">
                                    <input class="form-control" name="row[name]" type="text">
                                    <span class="input-group-addon name-suffix hidden"></span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group" data-type="title">
                            <label class="control-label col-xs-12 col-sm-3">中文名:</label>
                            <div class="col-xs-12 col-sm-9">
                                <input class="form-control" name="row[title]" type="text">
                            </div>
                        </div>
                        <div class="form-group" data-type="defaultValue">
                            <label class="control-label col-xs-12 col-sm-3">默认值:</label>
                            <div class="col-xs-12 col-sm-9">
                                <input class="form-control" name="row[defaultValue]" type="text" value="">
                            </div>
                        </div>
                        <div class="form-group hidden" data-type="decimal">
                            <label class="control-label col-xs-12 col-sm-3">小数点:</label>
                            <div class="col-xs-12 col-sm-9">
                                <input class="form-control" name="row[decimal]" type="text" value="0">
                            </div>
                        </div>
                        <div class="form-group hidden" data-type="multiple">
                            <label class="control-label col-xs-12 col-sm-3">单/多选:</label>
                            <div class="col-xs-12 col-sm-9">
                                <div class="radio">
                                    <label for="multiple-1"><input id="multiple-1" checked="checked" name="row[multiple]" type="radio" value="1"> 单选</label>
                                    <label for="multiple-2"><input id="multiple-2" name="row[multiple]" type="radio" value="2"> 多选</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group hidden" data-type="options">
                            <label class="control-label col-xs-12 col-sm-3">选项:</label>
                            <div class="col-xs-12 col-sm-9">
                                <dl class="fieldlist" data-name="row[options]" data-template="optionstpl">
                                    <dd>
                                        <ins>值</ins>
                                        <ins>标题</ins>
                                    </dd>
                                    <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a></dd>
                                    <textarea name="row[options]" class="form-control hide" cols="30" rows="5">[{key:"",value:""}]</textarea>
                                </dl>
                                <script id="optionstpl" type="text/html">
                                    <dd class="form-inline">
                                        <ins>
                                            <input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" value="<%=row.key%>" placeholder="" size="10">
                                        </ins>
                                        <ins>
                                            <input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" value="<%=row.value%>" placeholder="" size="10">
                                        </ins>
                                        <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                                    </dd>
                                </script>
                            </div>
                        </div>
                        <div class="form-group hidden" data-type="datasource">
                            <label class="control-label col-xs-12 col-sm-3">数据源:</label>
                            <div class="col-xs-12 col-sm-9">
                                <input class="form-control" name="row[datasource]" disabled="disabled" type="text">
                            </div>
                        </div>
                        <button type="reset" class="btn btn-danger btn-embossed pull-right">{:__('Reset')}</button>
                    </form>
                </div>
                <div class="tab-pane" id="billConfig">
                    <form class="form-horizontal" role="form" id="billConfig-form">
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-3">显示字段:</label>
                            <div class="col-xs-12 col-sm-9">
                                <select name="fields[]" id="fields" multiple style="height:30px;" class="form-control selectpicker" title="留空表示全选"></select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-3">选择图标:</label>
                            <div class="col-xs-12 col-sm-9">
                                <div class="input-group input-groupp-md">
                                    <input type="text" class="form-control" id="icon" name="icon" value="fa-circle-o" />
                                    <a href="javascript:;" class="btn-search-icon input-group-addon">搜索图标</a>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-3">控制器:</label>
                            <div class="col-xs-12 col-sm-9">
                                <input id="c-controller" class="form-control text-bold" name="controller" type="text">
                            </div>
                        </div>
                        <div class="form-group" style="padding: 15px;">
                            <legend class="text-info">关联模型选择(无关联模型可不选)</legend>
                            <div class="form-group" style="margin: 0 2px 0 2px;">
                                <table class="table table-responsive fieldlist table-bordered relation-fieldlist" data-name="relation_json" data-template="relationtpl" data-tag="tr">
                                    <tr><th>关联表</th><th>关联类型</th><th>关联外键</th><th>关联主键</th><th>显示字段</th><th>删除</th></tr>
                                    <tr><td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append btn-newrelation"><i class="fa fa-plus"></i> 追加关联模型</a></td></tr>
                                    <textarea name="relation_json" class="form-control hidden" cols="30" rows="5"></textarea>
                                </table>
                                <script type="text/html" id="relationtpl">
                                    <tr class="form-inline">
                                        <td><select name="relation[<%=index%>][relation]" class="form-control relationtable" data-live-search="true"></select></td>
                                        <td><select name="relation[<%=index%>][relationmode]" class="form-control relationmode"></select></td>
                                        <td><select name="relation[<%=index%>][relationforeignkey]" class="form-control relationforeignkey"></select></td>
                                        <td><select name="relation[<%=index%>][relationprimarykey]" class="form-control relationprimarykey"></select></td>
                                        <td><select name="relation[<%=index%>][relationfields][]" multiple class="form-control relationfields"></select></td>
                                        <td><span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span></td>
                                    </tr>
                                </script>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>
<!--<div class="footer">-->

<!--</div>-->
<script id="chooseicontpl" type="text/html">
    <div id="chooseicon">
        <div>
            <form onsubmit="return false;">
                <div class="input-group input-groupp-md">
                    <div class="input-group-addon">{:__('Search icon')}</div>
                    <input class="js-icon-search form-control" type="text" placeholder="">
                </div>
            </form>
        </div>
        <div>
            <ul class="list-inline">
                <% for(var i=0; i<iconlist.length; i++){ %>
                <li data-font="<%=iconlist[i]%>" data-toggle="tooltip" title="<%=iconlist[i]%>">
                    <i class="fa fa-<%=iconlist[i]%>"></i>
                </li>
                <% } %>
            </ul>
        </div>

    </div>
</script>